﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAWSharp.DSP.EQ
{
    public class EQ
    {
        internal double A, w0, sinw0, cosw0, alpha;
        internal double b0, b1, b2, a0, a1, a2, xn1, xn2, yn, yn1, yn2, b0a0, b1a0, b2a0, a1a0, a2a0;

        public float Process(float input)
        {
            yn = b0a0 * input + b1a0 * xn1 + b2a0 * xn2 - a1a0 * yn1 - a2a0 * yn2;
            
            xn1 = input;
            xn2 = xn1;

            yn2 = yn1;
            yn1 = yn;
            
            return (float)yn;
        }
    }
}
